package com.saile.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

public class Tools {
	public static String getUUID() {
		return UUID.randomUUID().toString().replaceAll("-", "");
	}

	public static String geturl(HttpServletRequest request) {

		if (request == null) {
			return "";
		}

		String url = "";
		url = request.getRequestURL().toString();
		System.out.println("url:============>>" + url);
		// url = "http://" + request.getLocalName() + url +
		// request.getServletPath();

		java.util.Enumeration names = request.getParameterNames();
		int i = 0;
		String requestPageUrl = "";
		if (!StringUtils.isEmpty(request.getQueryString())) {
			url = url + "?" + request.getQueryString();
		}
		return url;
	}

	public static void main(String[] args) {
		System.out.println(getUUID());
	}

	
}
